//
//  CaogaoViewCell.m
//  YiqiMobile
//
//  Created by henry on 13-3-26.
//  Copyright (c) 2013年 henry. All rights reserved.
//

#import "CaogaoViewCell.h"
#import "Config.h"
#import "Utility.h"

@implementation CaogaoViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        UIImageView *bgImgae=[[UIImageView alloc] initWithImage:[Utility imageNamed:@"cg_bg3.png"]];
        bgImgae.frame=self.frame;
        self.backgroundView=bgImgae;
       
        self.contentText=[Utility detailTextLabel:CGRectZero andFontSize:15.0];
        self.contentText.numberOfLines=0;
        self.contentText.textColor=UIColorFromRGB(0x000000);
        [self addSubview:self.contentText];
        
        self.detailText=[Utility detailTextLabel:CGRectZero andFontSize:9.0];
        self.detailText.textColor=UIColorFromRGB(0x666666);
        [self addSubview:self.detailText];
        
        self.statusImage=[[UIImageView alloc] initWithFrame:CGRectZero];
        self.statusImage.image=[Utility imageNamed:@"qznew.png"];
        self.statusImage.hidden=YES;
        [self addSubview:self.statusImage];
        
        self.popButtontop=[Utility customButton:self action:@selector(showMenu:) normalImage:@"cg_menubutton_normal.png" lightedImage:@"cg_menubutton_hover.png" frame:CGRectZero title:nil tag:0];
        self.popButtontop.hidden=YES;
        [self addSubview:self.popButtontop];
        self.popButtonbutton=[Utility customButton:self action:@selector(showMenu:) normalImage:@"cg_menubutton_normal.png" lightedImage:@"cg_menubutton_hover.png" frame:CGRectZero title:nil tag:0];
        [self addSubview:self.popButtonbutton];

         UIButton *customButton = [UIButton buttonWithType:UIButtonTypeCustom];
         customButton.frame=CGRectZero;
         self.voiceButton=customButton;
         [self addSubview:self.voiceButton];
        
        // Initialization code
        self.eMAsyncImageView=[[EMAsyncImageView alloc] initWithFrame:CGRectMake(10,12,100,100)];
        [self  addSubview:self.eMAsyncImageView];
    }
    return self;
}


-(void) showMenu:(id) sender{
    UIButton *button=(UIButton *)sender;
    int rowtemp;
    if (button==self.popButtonbutton) {
        rowtemp=self.row;
    }else{
        rowtemp=self.row-1;
    }
    if (_delegate&&[_delegate respondsToSelector:@selector(showMenu:)]) {
        [_delegate showMenu:rowtemp];
     }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
